//
//  WeaponUpgradesScreen.m
//  AngerDragon
//
//  Created by gaotime_macbook_2 on 11-12-2.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "WeaponUpgradesScreen.h"
#import "MainScreen.h"
#import "LevelSelectionScreen.h"

@implementation WeaponUpgradesScreen

- (void) dealloc {
	CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
	
	[super dealloc];
}

-(id) init {
	[super init];
	
	/// "喷火术"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_1 = [CCMenuItemFont itemFromString: @"喷火术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_1 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "龙息术"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_2 = [CCMenuItemFont itemFromString: @"龙息术 L1"];
	[a_p_cls_menu_title_2 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_2 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "石肤术"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_3 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_3 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_3 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
/*	
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_4 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_4 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_5 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_5 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_6 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_6 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_7 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_7 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_8 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_8 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_9 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_9 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_10 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_10 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_11 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_11 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	/// "test"
	/// 标题  
	[CCMenuItemFont setFontName:@"American Typewriter"];
	[CCMenuItemFont setFontSize:18];
	CCMenuItemFont *a_p_cls_menu_title_12 = [CCMenuItemFont itemFromString: @"石肤术 L1"];
	[a_p_cls_menu_title_1 setIsEnabled:NO];// 用一个禁止状态的菜单项作为标题
	/// 按钮
	[CCMenuItemFont setFontName: @"Marker Felt"];
	[CCMenuItemFont setFontSize:26];
	CCMenuItemToggle *a_p_cls_menu_item_12 = [CCMenuItemToggle itemWithTarget:self 
																																	selector:@selector(WeaponUpgradesScreen_upgradeMenuClickCallback:) 
																																		 items:[CCMenuItemFont itemFromString: @"升级"], nil];
	
*/	
	
	
	
	
	
	
	
	
	 	
	/// go back 按钮, 使用 位图字体
	CCLabelBMFont *a_p_cls_go_back_label = [CCLabelBMFont labelWithString:@"Go back" fntFile:@"font01.fnt"];
	
 	CCMenuItemLabel *a_p_cls_menu_go_back = [CCMenuItemLabel itemWithLabel:a_p_cls_go_back_label 
																									                target:self 
																																selector:@selector(WeaponUpgradesScreen_goBackMenuClickCallback:)];
  //a_p_cls_menu_go_back.scale = 1.5;
	
	/// continue 按钮, 使用 位图字体
	CCLabelBMFont *a_p_cls_continue_label = [CCLabelBMFont labelWithString:@"Continue" fntFile:@"font01.fnt"];
	
 	CCMenuItemLabel *a_p_cls_continue = [CCMenuItemLabel itemWithLabel:a_p_cls_continue_label 
																															target:self 
																														selector:@selector(WeaponUpgradesScreen_continueMenuClickCallback:)];
	
	
	// 组成菜单局
	CCMenu *a_p_cls_menu_list = [CCMenu menuWithItems:
															 a_p_cls_menu_title_1, a_p_cls_menu_item_1, 
															 a_p_cls_menu_title_2, a_p_cls_menu_item_2,
															 a_p_cls_menu_title_3, a_p_cls_menu_item_3,
															 //a_p_cls_menu_title_4, a_p_cls_menu_item_4, 
//															 a_p_cls_menu_title_5, a_p_cls_menu_item_5,
//															 a_p_cls_menu_title_6, a_p_cls_menu_item_6,
//															 a_p_cls_menu_title_7, a_p_cls_menu_item_7, 
//															 a_p_cls_menu_title_8, a_p_cls_menu_item_8,
//															 a_p_cls_menu_title_9, a_p_cls_menu_item_9,
//															 a_p_cls_menu_title_10, a_p_cls_menu_item_10,
//															 a_p_cls_menu_title_11, a_p_cls_menu_item_11,
//															 a_p_cls_menu_title_12, a_p_cls_menu_item_12,
															 
															 a_p_cls_menu_go_back, a_p_cls_continue,
															 nil];  
	/// 垂直排成一排
	[a_p_cls_menu_list alignItemsInColumns:
	 [NSNumber numberWithUnsignedInt:2],
	 [NSNumber numberWithUnsignedInt:2],
	 [NSNumber numberWithUnsignedInt:2],
	 //[NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
//	 [NSNumber numberWithUnsignedInt:2],
	 
	 [NSNumber numberWithUnsignedInt:2],
	 
	 nil
	 ];  
	
	/// 要想手动修改 菜单控件的坐标, 必须在布局动作完成后(alignItemsInColumns 布局动作)
	a_p_cls_menu_go_back.position = 
		ccp(a_p_cls_menu_go_back.contentSize.width - [[CCDirector sharedDirector] winSize].width / 2, 
				a_p_cls_menu_go_back.contentSize.height - [[CCDirector sharedDirector] winSize].height / 2);
	
	a_p_cls_continue.position = 
	ccp([[CCDirector sharedDirector] winSize].width/2 - a_p_cls_continue.contentSize.width, 
			a_p_cls_continue.contentSize.height - [[CCDirector sharedDirector] winSize].height / 2);
	
	/// 
	[self addChild: a_p_cls_menu_list];
	
	return self;
}

/**
 * @brief 返回主菜单 被点击后的触发函数
 *
 * @param[in] (id) sender
 * @param[out] nil
 *
 * @return void
 *
 * @note注解
 *
 */
-(void) WeaponUpgradesScreen_goBackMenuClickCallback: (id) sender {
	CCScene *a_p_cls_main_screen_scene = [CCScene node];
	[a_p_cls_main_screen_scene addChild:[MainScreen node]];
	
	[[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInL transitionWithDuration:1.2f 
																																									 scene:a_p_cls_main_screen_scene]];	
	
}

/**
 * @brief 继续游戏 被点击后的触发函数
 *
 * @param[in] (id) sender
 * @param[out] nil
 *
 * @return void
 *
 * @note注解
 *
 */
-(void) WeaponUpgradesScreen_continueMenuClickCallback: (id) sender {
	CCScene *a_p_cls_level_selection_screen_scene = [CCScene node];
	[a_p_cls_level_selection_screen_scene addChild:[LevelSelectionScreen node]];
	
	[[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInR transitionWithDuration:1.2f 
																																									 scene:a_p_cls_level_selection_screen_scene]];	
	
}

/**
 * @brief 购买游戏币按钮 被点击后的触发函数
 *
 * @param[in] (id) sender
 * @param[out] nil
 *
 * @return void
 *
 * @note注解
 *
 */
-(void) WeaponUpgradesScreen_buyMoneyMenuClickCallback: (id) sender {
}

/**
 * @brief 升级武器按钮 被点击后的触发函数
 *
 * @param[in] (id) sender
 * @param[out] nil
 *
 * @return void
 *
 * @note注解
 *
 */
-(void) WeaponUpgradesScreen_upgradeMenuClickCallback: (id) sender {
}
@end
